<!--
	playsound
-->
<html>
    <head>
		<script src="nui://game/ui/jquery.js" type="text/javascript"></script>
		<style type="text/css">
			html {
				display: none;
			}
		</style>
    </head>
    <body>
		<script type="text/javascript">
            $(function() {
				let Swich = [];
				window.addEventListener("message", function(event) {
					if (event.data.PayloadType[0] === "Swich" && !Swich[event.data.Payload]) {
                        if (event.data.PayloadType[1] === "LocalSwich") {
							Swich[event.data.Payload] = new Audio("./sounds/function.ogg");
						} else {
							Swich[event.data.Payload] = new Audio("./sounds/click.ogg");
						}

                        Swich[event.data.Payload].play();
                        Swich[event.data.Payload].addEventListener("ended", function(){
                            Swich[event.data.Payload] = null;
                        });
					}
				});
			});
			$(function() {
				let Panics = [];
				window.addEventListener("message", function(event) {
					if (event.data.PayloadType[0] === "Panic" && !Panics[event.data.Payload]) {
                        if (event.data.PayloadType[1] === "LocalPanic") {
							Panics[event.data.Payload] = new Audio("./sounds/localpanic.ogg");
						} else {
							Panics[event.data.Payload] = new Audio("./sounds/externalpanic.ogg");
						}

                        Panics[event.data.Payload].play();
                        Panics[event.data.Payload].addEventListener("ended", function(){
                            Panics[event.data.Payload] = null;
                        });
					}
				});
			});
			$(function() {
				let dispatch = [];
				window.addEventListener("message", function(event) {
					if (event.data.PayloadType[0] === "Dispatch" && !dispatch[event.data.Payload]) {
                        if (event.data.PayloadType[1] === "dispatch") {
							dispatch[event.data.Payload] = new Audio("./sounds/dispatch.ogg");
						} else {
							dispatch[event.data.Payload] = new Audio("./sounds/dispatch.ogg");
						}

                        dispatch[event.data.Payload].play();
                        dispatch[event.data.Payload].addEventListener("ended", function(){
                            dispatch[event.data.Payload] = null;
                        });
					}
				});
			});
        </script>
    </body>
</html>